package work_pattern.work_queues;

import com.rabbitmq.client.Channel;
import work_pattern.Constant;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer {
    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = Constant.createChannel();
        channel.queueDeclare("hello", true, false, false, null);
        for (int i = 0; i < 10; i++) {
            channel.basicPublish("", "hello", null, new String("hello " + i).getBytes());
        }
        System.out.println("消息发送成功");
    }
}
